﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using NetworkUtils;

namespace Server
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Server is running");
            IPAddress ip = IPAddress.Parse("127.0.0.1");
            TcpListener listener = new TcpListener(ip, 8500);
            listener.Start();
            while (true)
            {
                TcpClient client = listener.AcceptTcpClient();
                RemoteClient rc = new RemoteClient(client);
                rc.OnDataReceived += ShowData;
            }

        }

        static public void ShowData(object d)
        {
            Data data = (Data)d;
            Console.WriteLine("价格:" + data.Price.ToString());
        }
    }
}
